<?php
/**
 * 建物詳細用関数<br />
 *
 * @package apamanshop
 * @author　
 * @copyright　
 */
class Rstdtl_Model_Articledtl extends Rstdtl_Model_Base {

    // DBコネクション
    private $_db;

    /**
     * コンストラクタ
     */
    function __construct() {
        $this->_db = $this->getDbConnection();
        //parent::__construct();
    }
    /**
     * デストラクタ
     */
    function __destruct() {
        if (!empty($this->_db)) {
            $this->_db->closeConnection();
        }
        //parent::__destruct();
    }
    
    public function getArticleDetail($code, $heya = null) {
$sql = "
		select
			T03.T03_HEYA_CD
			,T03.T03_TATEMONO_CD
			,T03.T03_TATEMONO_NAME
			,T03.T03_TATEMONO_NAME_KOUKAI
			,T03.T03_TENPO_CD
			,T03.T03_ORIGINAL_TATEMONO_CD01
			,T03.T03_ORIGINAL_TATEMONO_CD02
			,T03.T03_ORIGINAL_HEYA_CD01
			,T03.T03_ORIGINAL_HEYA_CD02
			,T03.T03_TODOUFUKEN_CD
			,T03.T03_SHIKUCHOUSON_CD
            ,(SELECT M01_SHIKUCHOUSON FROM M01JYUUSHO WHERE M01_TODOUFUKEN_CD = T03.T03_TODOUFUKEN_CD AND M01_SHIKUCHOUSON_CD = T03.T03_SHIKUCHOUSON_CD AND rownum = 1) AS T03_SHIKUCHOUSON_NAME_JP
			,T03.T03_CHOUMEI_CD
		    ,T03.T03_CHOUMOKU_CD
		    ,T03.T03_JYUUSHO_TEXT
		    ,T03.T03_BANCHI
			,T03.T03_CHUUSHAJYOU_KUBUN
		    ,T03.T03_ANNAI_MAP_USE_FLAG
		    ,T03.T03_TATEMONO_TYPE_CD
		    ,T03.T03_TATEMONO_TYPE
		    ,T03.T03_TATEMONO_KOUZOU_CD
		    ,T03.T03_TATEMONO_KOUZOU
		    ,T03.T03_KAIDATE
		    ,T03.T03_KOSUU
		    ,T03.T03_KANSEINEN
		    ,T03.T03_KANSEITSUKI
		    ,T03.T03_KANSEIBI
			,T03.T03_SHINCHIKU_FLAG
			,T03.T03_TATEMONO_MENSEKI
			,T03.T03_SHIKICHI_MENSEKI
			,T03.T03_KAI
			,T03.T03_HEYA_BANGOU
			,T03.T03_HOUGAKU
			,T03.T03_MADORI_CD
			,T03.T03_MADORI
			,T03.T03_SENYUU_MENSEKI
			,T03.T03_YACHIN
			,T03.T03_YACHIN_TAX
			,T03.T03_KANRIHI
			,T03.T03_KANRIHI_TAX
			,T03.T03_KYOUEKIHI
			,T03.T03_KYOUEKIHI_TAX
			,T03.T03_SHIKIKIN
			,T03.T03_REIKIN
			,T03.T03_HOSHOUKIN
			,T03.T03_SHOUKYAKU_KUBUN
			,T03.T03_SHOUKYAKUKIN
			,T03.T03_KOUSHINRYOU
			,T03.T03_SHIKIKIN_TSUKISUU
			,T03.T03_REIKIN_TSUKISUU
			,T03.T03_HOSHOUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKINRITSU
			,T03.T03_KOUSHINRYOUTSUKISUU
			,T03.T03_TESUURYOU_FLAG
			,T03.T03_KOUSHINRYOU_FLAG
			,T03.T03_NYUUKYO_NEN
			,T03.T03_NYUUKYO_TSUKI
			,T03.T03_NYUUKYO_ZIKI
			,T03.T03_KOUTSUU_CD01
			,T03.T03_ENSEN_CD01
			,T03.T03_ENSEN_NAME
			,T03.T03_EKI_CD01
			,T03.T03_EKI_NAME
			,T03.T03_BUS_GAISHA
			,T03.T03_BUS_JYOUSHA
			,T03.T03_BUS_STOP
			,T03.T03_TOHO01
			,T03.T03_KOUTSUU_BIKOU01
			,T03.T03_KOUTSUU_TEXT01
			,T03.T03_RENRAKU_EKI_CD01
			,T03.T03_KOUTSUU_CD02
			,T03.T03_ENSEN_CD02
			,T03.T03_ENSEN_NAME02
			,T03.T03_EKI_CD02
			,T03.T03_EKI_NAME02
			,T03.T03_BUS_GAISHA02
			,T03.T03_BUS_JYOUSHA02
			,T03.T03_BUS_STOP02
			,T03.T03_TOHO02
			,T03.T03_KOUTSUU_BIKOU02
			,T03.T03_KOUTSUU_TEXT02
			,T03.T03_RENRAKU_EKI_CD02
			,T03.T03_KOUTSUU_CD03
			,T03.T03_ENSEN_CD03
			,T03.T03_ENSEN_NAME03
			,T03.T03_EKI_CD03
			,T03.T03_EKI_NAME03
			,T03.T03_BUS_GAISHA03
			,T03.T03_BUS_JYOUSHA03
			,T03.T03_BUS_STOP03
			,T03.T03_TOHO03
			,T03.T03_KOUTSUU_BIKOU03
			,T03.T03_KOUTSUU_TEXT03
			,T03.T03_RENRAKU_EKI_CD03
			,T03.T03_GAIKAN_GAZOU01
        	,DECODE(TRIM(NVL(T03_GAIKAN_GAZOU01, '')),'', 1,0) GAIKAN_UMU_FLAG
			,T03.T03_GAIKAN_GAZOU02
			,T03.T03_GAIKAN_GAZOU03
			,T03.T03_GAIKAN_GAZOU04
			,T03.T03_GAIKAN_GAZOU05
			,T03.T03_SHUHEN_GAZOU01
			,T03.T03_SHUHEN_GAZOU02
			,T03.T03_NAISOU_GAZOU01
			,T03.T03_NAISOU_GAZOU02
			,T03.T03_NAISOU_GAZOU03
			,T03.T03_NAISOU_GAZOU04
			,T03.T03_NAISOU_GAZOU05
			,T03.T03_NAISOU_GAZOU06
			,T03.T03_NAISOU_GAZOU07
			,T03.T03_NAISOU_GAZOU08
			,T03.T03_NAISOU_GAZOU09
			,T03.T03_NAISOU_GAZOU10
			,T03.T03_MADORIZU
			,T03.T03_TOUROKUBI
			,T03.T03_TOUROKUBI_STR
			,T03.T03_SAKUSEIBI
			,T03.T03_KOUSHINBI
			,T03.T03_FREERENT_FLAG
			,T03.T03_HEYAWARI_FLAG
			,T03.T03_MEYASU_CHINRYO
			,T03.T03_TEN_MEYASU_CHINRYO
			,T03.T03_GAIKAN_GAZOU_COMMON01
			,T03.T03_GAIKAN_GAZOU_COMMON02
			,T03.T03_GAIKAN_GAZOU_COMMON03
			,T03.T03_GAIKAN_GAZOU_COMMON04
			,T03.T03_GAIKAN_GAZOU_COMMON05
			,T03.T03_HAICHIZU_COMMON
			,T03.T03_SHUHEN_GAZOU_COMMON01
			,T03.T03_SHUHEN_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON01
			,T03.T03_NAISOU_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON03
			,T03.T03_NAISOU_GAZOU_COMMON04
			,T03.T03_NAISOU_GAZOU_COMMON05
			,T03.T03_NAISOU_GAZOU_COMMON06
			,T03.T03_NAISOU_GAZOU_COMMON07
			,T03.T03_NAISOU_GAZOU_COMMON08
			,T03.T03_NAISOU_GAZOU_COMMON09
			,T03.T03_NAISOU_GAZOU_COMMON10
			,T03.T03_MADORIZU_COMMON
			,T03.T03_PANORAMA_GAZOU01
			,T03.T03_PANORAMA_GAZOU02
			,T03.T03_PANORAMA_GAZOU_COMMON01
			,T03.T03_PANORAMA_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU01
			,T03.T03_FREE_GAZOU_TYPE01
			,T03.T03_FREE_GAZOU02
			,T03.T03_FREE_GAZOU_TYPE02
			,T03.T03_FREE_GAZOU03
			,T03.T03_FREE_GAZOU_TYPE03
			,T03.T03_FREE_GAZOU04
			,T03.T03_FREE_GAZOU_TYPE04
			,T03.T03_FREE_GAZOU05
			,T03.T03_FREE_GAZOU_TYPE05
			,T03.T03_FREE_GAZOU06
			,T03.T03_FREE_GAZOU_TYPE06
			,T03.T03_FREE_GAZOU07
			,T03.T03_FREE_GAZOU_TYPE07
			,T03.T03_FREE_GAZOU08
			,T03.T03_FREE_GAZOU_TYPE08
			,T03.T03_FREE_GAZOU09
			,T03.T03_FREE_GAZOU_TYPE09
			,T03.T03_FREE_GAZOU10
			,T03.T03_FREE_GAZOU_TYPE10
			,T03.T03_FREE_GAZOU11
			,T03.T03_FREE_GAZOU_TYPE11
			,T03.T03_FREE_GAZOU12
			,T03.T03_FREE_GAZOU_TYPE12
			,T03.T03_FREE_GAZOU_COMMON01
			,T03.T03_FREE_GAZOU_TYPE_COMMON01
			,T03.T03_FREE_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU_TYPE_COMMON02
			,T03.T03_FREE_GAZOU_COMMON03
			,T03.T03_FREE_GAZOU_TYPE_COMMON03
			,T03.T03_FREE_GAZOU_COMMON04
			,T03.T03_FREE_GAZOU_TYPE_COMMON04
			,T03.T03_FREE_GAZOU_COMMON05
			,T03.T03_FREE_GAZOU_TYPE_COMMON05
			,T03.T03_FREE_GAZOU_COMMON06
			,T03.T03_FREE_GAZOU_TYPE_COMMON06
			,T03.T03_FREE_GAZOU_COMMON07
			,T03.T03_FREE_GAZOU_TYPE_COMMON07
			,T03.T03_FREE_GAZOU_COMMON08
			,T03.T03_FREE_GAZOU_TYPE_COMMON08
			,T03.T03_FREE_GAZOU_COMMON09
			,T03.T03_FREE_GAZOU_TYPE_COMMON09
			,T03.T03_FREE_GAZOU_COMMON10
			,T03.T03_FREE_GAZOU_TYPE_COMMON10
			,T03.T03_FREE_GAZOU_COMMON11
			,T03.T03_FREE_GAZOU_TYPE_COMMON11
			,T03.T03_FREE_GAZOU_COMMON12
			,T03.T03_FREE_GAZOU_TYPE_COMMON12
			,T03.T03_NAISOU_GAZOU_TYPE01
			,T03.T03_NAISOU_GAZOU_TYPE02
			,T03.T03_NAISOU_GAZOU_TYPE03
			,T03.T03_NAISOU_GAZOU_TYPE04
			,T03.T03_NAISOU_GAZOU_TYPE05
			,T03.T03_NAISOU_GAZOU_TYPE06
			,T03.T03_NAISOU_GAZOU_TYPE07
			,T03.T03_NAISOU_GAZOU_TYPE08
			,T03.T03_NAISOU_GAZOU_TYPE09
			,T03.T03_NAISOU_GAZOU_TYPE10
			,T03.T03_YACHIN_KANRI_KYOEKI_SUM
			,T03.T03_TIKU_NENSU
			,CASE WHEN (( (sysdate - 7) < T03.T03_KOUSHINBI ) AND ( T03.T03_KIGENGIRE_SHUUSEI_FLAG <> 1 )) THEN 0 ELSE 1 END AS SHINCHAKU_FLAG
			,T03.T03_SHATAKU_TEKIYOU_FLAG
			,T03.T03_KASHIDASHI_KUBUN
			,T03.T03_SHOKI_HIYO
			,T03.T03_TEN_SHOKI_HIYO
			,T03.T03_KOUKOKU_KAISHA_CD
			,T03.T03_KOUKOKU_TOIAWASE_NO
			,T03.T03_MOTODUKE_FLAG
			,T03.T03_TENPO_DISTANCE
			,T03.T03_TEN_HEYAWARI_FLAG
			,T03.T03_PR01
			,T03.T03_PR02
			,T03.T03_TEN_FREERENT_FLAG
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,9999999,T03.T03_MEYASU_CHINRYO) END) AS T03_SORT_MEYASU_CHINRYO
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,0,T03.T03_MEYASU_CHINRYO) END) AS T03_SORT_MEYASU_CHINRYO_DESC
			,T03.T03_SAIGAI_HUTU_KBN
			,T03.T03_SAIGAI_TEIKI_FLG
			,T03.T03_SAIGAI_YUGU_FLAG
			,T03.T03_DAIHYO_FLG
			,T03.T03_DAIHYO_HEYA_CD
			,T03.T03_DAIHYO_TATEMONO_CD
			,T03.T03_TENPO_HYOJI_YUSEN
			,T03.T03_MIN_SENYUU_MENSEKI
			,T03.T03_TATEMONO_NAME_KANA
			,T03.T03_SETSUBI16              as T03_SETSUBI16_ICON
			,T03.T03_SETSUBI63              as T03_SETSUBI63_ICON
			,T03.T03_SETSUBI03              as T03_SETSUBI03_ICON
			,T03.T03_SETSUBI34              as T03_SETSUBI34_ICON
			,T03.T03_SETSUBI35              as T03_SETSUBI35_ICON
			,T03.T03_SETSUBI08              as T03_SETSUBI08_ICON
			,T03.T03_SETSUBI09              as T03_SETSUBI09_ICON
			,T03.T03_SETSUBI23              as T03_SETSUBI23_ICON
			,T03.T03_SETSUBI98              as T03_SETSUBI98_ICON
			,T03.T03_SETSUBI71              as T03_SETSUBI71_ICON
			,T03.T03_NYUUKYO_JYOUKEN12      as T03_NYUUKYO_JYOUKEN12_ICON
			,T03.T03_SETSUBI24              as T03_SETSUBI24_ICON
			,T03.T03_SETSUBI02              as T03_SETSUBI02_ICON
			,T03.T03_SETSUBI64              as T03_SETSUBI64_ICON
			,T03.T03_SETSUBI15              as T03_SETSUBI15_ICON
			,T03.T03_SETSUBI01              as T03_SETSUBI01_ICON
			,T03.T03_SETSUBI57              as T03_SETSUBI57_ICON
			,T03.T03_SETSUBI31              as T03_SETSUBI31_ICON
			,T03.T03_FREERENT_FLAG          as T03_FREERENT_FLAG_ICON
			,T03.T03_NYUUKYO_JYOUKEN02      as T03_NYUUKYO_JYOUKEN02_ICON
			,T03.T03_SETSUBI67              as T03_SETSUBI67_ICON
			,T03.T03_SETSUBI45              as T03_SETSUBI45_ICON
			,T03.T03_SETSUBI29              as T03_SETSUBI29_ICON
			,T03.T03_SETSUBI32              as T03_SETSUBI32_ICON
			,T03.T03_SETSUBI47              as T03_SETSUBI47_ICON
			,T03.T03_NYUUKYO_JYOUKEN03      as T03_NYUUKYO_JYOUKEN03_ICON
			,T03.T03_SETSUBI68              as T03_SETSUBI68_ICON
			,T03.T03_NYUUKYO_JYOUKEN01      as T03_NYUUKYO_JYOUKEN01_ICON
			,T03.T03_SETSUBI43              as T03_SETSUBI43_ICON
			,T03.T03_SETSUBI85              as T03_SETSUBI85_ICON
			,T03.T03_SETSUBI14              as T03_SETSUBI14_ICON
			,T03.T03_NYUUKYO_JYOUKEN10      as T03_NYUUKYO_JYOUKEN10_ICON
			,T03.T03_SETSUBI33              as T03_SETSUBI33_ICON
			,T03.T03_SETSUBI93              as T03_SETSUBI93_ICON
			,T03.T03_SETSUBI83              as T03_SETSUBI83_ICON
			,case when T03.T03_TOHO01 <= 3 or T03.T03_TOHO02 <= 3 or T03.T03_TOHO03 <= 3 then 1 else 0 end as T03_TOHO_ICON
			,T03.T03_SETSUBI70              as T03_SETSUBI70_ICON
			,T03.T03_NYUUKYO_JYOUKEN11      as T03_NYUUKYO_JYOUKEN11_ICON
			,T03.T03_SETSUBI72              as T03_SETSUBI72_ICON
			,T03.T03_SETSUBI82              as T03_SETSUBI82_ICON
			,T03.T03_SETSUBI86              as T03_SETSUBI86_ICON
			,T03.T03_SETSUBI94              as T03_SETSUBI94_ICON
			,T03.T03_SETSUBI61              as T03_SETSUBI61_ICON
			,T03.T03_SETSUBI38              as T03_SETSUBI38_ICON
			,T03.T03_SETSUBI56              as T03_SETSUBI56_ICON
            ,T03.T03_KEIDO
            ,T03.T03_IDO
            ,T03.T03_SHOUGAKKOU
			,T03.T03_CHUUGAKKOU
			,T03.T03_SHOUGAKKOU_KYORI
			,T03.T03_CHUUGAKKOU_KYORI
			,T03.T03_CONVENIENCE_KYORI
			,T03.T03_SUPERMARKET_KYORI
			,T03.T03_BYOUIN_KYORI
        	,NULL AS T03_KEISAI
		from 
			T03WEB_HEYA T03
		where
			--T03.T03_DAIHYO_FLG		=	1
            T03.T03_KOUKAI_FLAG		=	1
			AND T03.T03_DAIHYO_TATEMONO_CD	= '".$code."'";
        
 $sqlkeisai = "
		select
			T03.T03_HEYA_CD
			,T03.T03_TATEMONO_CD
 			,T03.T03_TATEMONO_NAME
			,T03.T03_TATEMONO_NAME_KOUKAI
			,T03.T03_TENPO_CD
			,T03.T03_ORIGINAL_TATEMONO_CD01
			,T03.T03_ORIGINAL_TATEMONO_CD02
			,T03.T03_ORIGINAL_HEYA_CD01
			,T03.T03_ORIGINAL_HEYA_CD02
			,T03.T03_TODOUFUKEN_CD
			,T03.T03_SHIKUCHOUSON_CD
            ,(SELECT M01_SHIKUCHOUSON FROM M01JYUUSHO WHERE M01_TODOUFUKEN_CD = T03.T03_TODOUFUKEN_CD AND M01_SHIKUCHOUSON_CD = T03.T03_SHIKUCHOUSON_CD AND rownum = 1) AS T03_SHIKUCHOUSON_NAME_JP
			,T03.T03_CHOUMEI_CD
		    ,T03.T03_CHOUMOKU_CD
		    ,T03.T03_JYUUSHO_TEXT
		    ,T03.T03_BANCHI
 			,T03.T03_CHUUSHAJYOU_KUBUN
		    ,T03.T03_ANNAI_MAP_USE_FLAG
		    ,T03.T03_TATEMONO_TYPE_CD
		    ,T03.T03_TATEMONO_TYPE
		    ,T03.T03_TATEMONO_KOUZOU_CD
		    ,T03.T03_TATEMONO_KOUZOU
		    ,T03.T03_KAIDATE
		    ,T03.T03_KOSUU
		    ,T03.T03_KANSEINEN
		    ,T03.T03_KANSEITSUKI
		    ,T03.T03_KANSEIBI
			,T03.T03_SHINCHIKU_FLAG
			,T03.T03_TATEMONO_MENSEKI
			,T03.T03_SHIKICHI_MENSEKI
			,T03.T03_KAI
			,T03.T03_HEYA_BANGOU
			,T03.T03_HOUGAKU
			,T03.T03_MADORI_CD
			,T03.T03_MADORI
			,T03.T03_SENYUU_MENSEKI
			,T03.T03_YACHIN
			,T03.T03_YACHIN_TAX
			,T03.T03_KANRIHI
			,T03.T03_KANRIHI_TAX
			,T03.T03_KYOUEKIHI
			,T03.T03_KYOUEKIHI_TAX
			,T03.T03_SHIKIKIN
			,T03.T03_REIKIN
			,T03.T03_HOSHOUKIN
			,T03.T03_SHOUKYAKU_KUBUN
			,T03.T03_SHOUKYAKUKIN
			,T03.T03_KOUSHINRYOU
			,T03.T03_SHIKIKIN_TSUKISUU
			,T03.T03_REIKIN_TSUKISUU
			,T03.T03_HOSHOUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKIN_TSUKISUU
			,T03.T03_SHOUKYAKUKINRITSU
			,T03.T03_KOUSHINRYOUTSUKISUU
			,T03.T03_TESUURYOU_FLAG
			,T03.T03_KOUSHINRYOU_FLAG
			,T03.T03_NYUUKYO_NEN
			,T03.T03_NYUUKYO_TSUKI
			,T03.T03_NYUUKYO_ZIKI
			,T03.T03_KOUTSUU_CD01
			,T03.T03_ENSEN_CD01
			,T03.T03_ENSEN_NAME
			,T03.T03_EKI_CD01
			,T03.T03_EKI_NAME
			,T03.T03_BUS_GAISHA
			,T03.T03_BUS_JYOUSHA
			,T03.T03_BUS_STOP
			,T03.T03_TOHO01
			,T03.T03_KOUTSUU_BIKOU01
			,T03.T03_KOUTSUU_TEXT01
			,T03.T03_RENRAKU_EKI_CD01
			,T03.T03_KOUTSUU_CD02
			,T03.T03_ENSEN_CD02
			,T03.T03_ENSEN_NAME02
			,T03.T03_EKI_CD02
			,T03.T03_EKI_NAME02
			,T03.T03_BUS_GAISHA02
			,T03.T03_BUS_JYOUSHA02
			,T03.T03_BUS_STOP02
			,T03.T03_TOHO02
			,T03.T03_KOUTSUU_BIKOU02
			,T03.T03_KOUTSUU_TEXT02
			,T03.T03_RENRAKU_EKI_CD02
			,T03.T03_KOUTSUU_CD03
			,T03.T03_ENSEN_CD03
			,T03.T03_ENSEN_NAME03
			,T03.T03_EKI_CD03
			,T03.T03_EKI_NAME03
			,T03.T03_BUS_GAISHA03
			,T03.T03_BUS_JYOUSHA03
			,T03.T03_BUS_STOP03
			,T03.T03_TOHO03
			,T03.T03_KOUTSUU_BIKOU03
			,T03.T03_KOUTSUU_TEXT03
			,T03.T03_RENRAKU_EKI_CD03
			,T03.T03_GAIKAN_GAZOU01
        	,DECODE(TRIM(NVL(T03_GAIKAN_GAZOU01, '')),'', 1,0) GAIKAN_UMU_FLAG
			,T03.T03_GAIKAN_GAZOU02
			,T03.T03_GAIKAN_GAZOU03
			,T03.T03_GAIKAN_GAZOU04
			,T03.T03_GAIKAN_GAZOU05
			,T03.T03_SHUHEN_GAZOU01
			,T03.T03_SHUHEN_GAZOU02
			,T03.T03_NAISOU_GAZOU01
			,T03.T03_NAISOU_GAZOU02
			,T03.T03_NAISOU_GAZOU03
			,T03.T03_NAISOU_GAZOU04
			,T03.T03_NAISOU_GAZOU05
			,T03.T03_NAISOU_GAZOU06
			,T03.T03_NAISOU_GAZOU07
			,T03.T03_NAISOU_GAZOU08
			,T03.T03_NAISOU_GAZOU09
			,T03.T03_NAISOU_GAZOU10
			,T03.T03_MADORIZU
			,T03.T03_TOUROKUBI
			,T03.T03_TOUROKUBI_STR
			,T03.T03_SAKUSEIBI
			,T03.T03_KOUSHINBI
			,T03.T03_FREERENT_FLAG
			,T03.T03_HEYAWARI_FLAG
			,T03.T03_MEYASU_CHINRYO
			,T03.T03_TEN_MEYASU_CHINRYO
			,T03.T03_GAIKAN_GAZOU_COMMON01
			,T03.T03_GAIKAN_GAZOU_COMMON02
			,T03.T03_GAIKAN_GAZOU_COMMON03
			,T03.T03_GAIKAN_GAZOU_COMMON04
			,T03.T03_GAIKAN_GAZOU_COMMON05
			,T03.T03_HAICHIZU_COMMON
			,T03.T03_SHUHEN_GAZOU_COMMON01
			,T03.T03_SHUHEN_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON01
			,T03.T03_NAISOU_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON03
			,T03.T03_NAISOU_GAZOU_COMMON04
			,T03.T03_NAISOU_GAZOU_COMMON05
			,T03.T03_NAISOU_GAZOU_COMMON06
			,T03.T03_NAISOU_GAZOU_COMMON07
			,T03.T03_NAISOU_GAZOU_COMMON08
			,T03.T03_NAISOU_GAZOU_COMMON09
			,T03.T03_NAISOU_GAZOU_COMMON10
			,T03.T03_MADORIZU_COMMON
			,T03.T03_PANORAMA_GAZOU01
			,T03.T03_PANORAMA_GAZOU02
			,T03.T03_PANORAMA_GAZOU_COMMON01
			,T03.T03_PANORAMA_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU01
			,T03.T03_FREE_GAZOU_TYPE01
			,T03.T03_FREE_GAZOU02
			,T03.T03_FREE_GAZOU_TYPE02
			,T03.T03_FREE_GAZOU03
			,T03.T03_FREE_GAZOU_TYPE03
			,T03.T03_FREE_GAZOU04
			,T03.T03_FREE_GAZOU_TYPE04
			,T03.T03_FREE_GAZOU05
			,T03.T03_FREE_GAZOU_TYPE05
			,T03.T03_FREE_GAZOU06
			,T03.T03_FREE_GAZOU_TYPE06
			,T03.T03_FREE_GAZOU07
			,T03.T03_FREE_GAZOU_TYPE07
			,T03.T03_FREE_GAZOU08
			,T03.T03_FREE_GAZOU_TYPE08
			,T03.T03_FREE_GAZOU09
			,T03.T03_FREE_GAZOU_TYPE09
			,T03.T03_FREE_GAZOU10
			,T03.T03_FREE_GAZOU_TYPE10
			,T03.T03_FREE_GAZOU11
			,T03.T03_FREE_GAZOU_TYPE11
			,T03.T03_FREE_GAZOU12
			,T03.T03_FREE_GAZOU_TYPE12
			,T03.T03_FREE_GAZOU_COMMON01
			,T03.T03_FREE_GAZOU_TYPE_COMMON01
			,T03.T03_FREE_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU_TYPE_COMMON02
			,T03.T03_FREE_GAZOU_COMMON03
			,T03.T03_FREE_GAZOU_TYPE_COMMON03
			,T03.T03_FREE_GAZOU_COMMON04
			,T03.T03_FREE_GAZOU_TYPE_COMMON04
			,T03.T03_FREE_GAZOU_COMMON05
			,T03.T03_FREE_GAZOU_TYPE_COMMON05
			,T03.T03_FREE_GAZOU_COMMON06
			,T03.T03_FREE_GAZOU_TYPE_COMMON06
			,T03.T03_FREE_GAZOU_COMMON07
			,T03.T03_FREE_GAZOU_TYPE_COMMON07
			,T03.T03_FREE_GAZOU_COMMON08
			,T03.T03_FREE_GAZOU_TYPE_COMMON08
			,T03.T03_FREE_GAZOU_COMMON09
			,T03.T03_FREE_GAZOU_TYPE_COMMON09
			,T03.T03_FREE_GAZOU_COMMON10
			,T03.T03_FREE_GAZOU_TYPE_COMMON10
			,T03.T03_FREE_GAZOU_COMMON11
			,T03.T03_FREE_GAZOU_TYPE_COMMON11
			,T03.T03_FREE_GAZOU_COMMON12
			,T03.T03_FREE_GAZOU_TYPE_COMMON12
			,T03.T03_NAISOU_GAZOU_TYPE01
			,T03.T03_NAISOU_GAZOU_TYPE02
			,T03.T03_NAISOU_GAZOU_TYPE03
			,T03.T03_NAISOU_GAZOU_TYPE04
			,T03.T03_NAISOU_GAZOU_TYPE05
			,T03.T03_NAISOU_GAZOU_TYPE06
			,T03.T03_NAISOU_GAZOU_TYPE07
			,T03.T03_NAISOU_GAZOU_TYPE08
			,T03.T03_NAISOU_GAZOU_TYPE09
			,T03.T03_NAISOU_GAZOU_TYPE10
			,T03.T03_YACHIN_KANRI_KYOEKI_SUM
			,T03.T03_TIKU_NENSU
			,CASE WHEN (( (sysdate - 7) < T03.T03_KOUSHINBI ) AND ( T03.T03_KIGENGIRE_SHUUSEI_FLAG <> 1 )) THEN 0 ELSE 1 END AS SHINCHAKU_FLAG
			,T03.T03_SHATAKU_TEKIYOU_FLAG
			,T03.T03_KASHIDASHI_KUBUN
			,T03.T03_SHOKI_HIYO
			,T03.T03_TEN_SHOKI_HIYO
			,T03.T03_KOUKOKU_KAISHA_CD
			,T03.T03_KOUKOKU_TOIAWASE_NO
			,T03.T03_MOTODUKE_FLAG
			,T03.T03_TENPO_DISTANCE
			,T03.T03_TEN_HEYAWARI_FLAG
			,T03.T03_PR01
			,T03.T03_PR02
			,T03.T03_TEN_FREERENT_FLAG
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,9999999,T03.T03_MEYASU_CHINRYO) END) AS T03_SORT_MEYASU_CHINRYO
			,(CASE WHEN NVL(T03.T03_TEN_MEYASU_CHINRYO,0) != 0 THEN T03.T03_TEN_MEYASU_CHINRYO ELSE DECODE(NVL(T03.T03_MEYASU_CHINRYO,0),0,0,T03.T03_MEYASU_CHINRYO) END) AS T03_SORT_MEYASU_CHINRYO_DESC
			,T03.T03_SAIGAI_HUTU_KBN
			,T03.T03_SAIGAI_TEIKI_FLG
			,T03.T03_SAIGAI_YUGU_FLAG
			,T03.T03_DAIHYO_FLG
			,T03.T03_DAIHYO_HEYA_CD
			,T03.T03_DAIHYO_TATEMONO_CD
			,T03.T03_TENPO_HYOJI_YUSEN
			,T03.T03_MIN_SENYUU_MENSEKI
			,T03.T03_TATEMONO_NAME_KANA
			,T03.T03_SETSUBI16              as T03_SETSUBI16_ICON
			,T03.T03_SETSUBI63              as T03_SETSUBI63_ICON
			,T03.T03_SETSUBI03              as T03_SETSUBI03_ICON
			,T03.T03_SETSUBI34              as T03_SETSUBI34_ICON
			,T03.T03_SETSUBI35              as T03_SETSUBI35_ICON
			,T03.T03_SETSUBI08              as T03_SETSUBI08_ICON
			,T03.T03_SETSUBI09              as T03_SETSUBI09_ICON
			,T03.T03_SETSUBI23              as T03_SETSUBI23_ICON
			,T03.T03_SETSUBI98              as T03_SETSUBI98_ICON
			,T03.T03_SETSUBI71              as T03_SETSUBI71_ICON
			,T03.T03_NYUUKYO_JYOUKEN12      as T03_NYUUKYO_JYOUKEN12_ICON
			,T03.T03_SETSUBI24              as T03_SETSUBI24_ICON
			,T03.T03_SETSUBI02              as T03_SETSUBI02_ICON
			,T03.T03_SETSUBI64              as T03_SETSUBI64_ICON
			,T03.T03_SETSUBI15              as T03_SETSUBI15_ICON
			,T03.T03_SETSUBI01              as T03_SETSUBI01_ICON
			,T03.T03_SETSUBI57              as T03_SETSUBI57_ICON
			,T03.T03_SETSUBI31              as T03_SETSUBI31_ICON
			,T03.T03_FREERENT_FLAG          as T03_FREERENT_FLAG_ICON
			,T03.T03_NYUUKYO_JYOUKEN02      as T03_NYUUKYO_JYOUKEN02_ICON
			,T03.T03_SETSUBI67              as T03_SETSUBI67_ICON
			,T03.T03_SETSUBI45              as T03_SETSUBI45_ICON
			,T03.T03_SETSUBI29              as T03_SETSUBI29_ICON
			,T03.T03_SETSUBI32              as T03_SETSUBI32_ICON
			,T03.T03_SETSUBI47              as T03_SETSUBI47_ICON
			,T03.T03_NYUUKYO_JYOUKEN03      as T03_NYUUKYO_JYOUKEN03_ICON
			,T03.T03_SETSUBI68              as T03_SETSUBI68_ICON
			,T03.T03_NYUUKYO_JYOUKEN01      as T03_NYUUKYO_JYOUKEN01_ICON
			,T03.T03_SETSUBI43              as T03_SETSUBI43_ICON
			,T03.T03_SETSUBI85              as T03_SETSUBI85_ICON
			,T03.T03_SETSUBI14              as T03_SETSUBI14_ICON
			,T03.T03_NYUUKYO_JYOUKEN10      as T03_NYUUKYO_JYOUKEN10_ICON
			,T03.T03_SETSUBI33              as T03_SETSUBI33_ICON
			,T03.T03_SETSUBI93              as T03_SETSUBI93_ICON
			,T03.T03_SETSUBI83              as T03_SETSUBI83_ICON
			,case when T03.T03_TOHO01 <= 3 or T03.T03_TOHO02 <= 3 or T03.T03_TOHO03 <= 3 then 1 else 0 end as T03_TOHO_ICON
			,T03.T03_SETSUBI70              as T03_SETSUBI70_ICON
			,T03.T03_NYUUKYO_JYOUKEN11      as T03_NYUUKYO_JYOUKEN11_ICON
			,T03.T03_SETSUBI72              as T03_SETSUBI72_ICON
			,T03.T03_SETSUBI82              as T03_SETSUBI82_ICON
			,T03.T03_SETSUBI86              as T03_SETSUBI86_ICON
			,T03.T03_SETSUBI94              as T03_SETSUBI94_ICON
			,T03.T03_SETSUBI61              as T03_SETSUBI61_ICON
			,T03.T03_SETSUBI38              as T03_SETSUBI38_ICON
			,T03.T03_SETSUBI56              as T03_SETSUBI56_ICON
            ,T03.T03_KEIDO
            ,T03.T03_IDO
            ,T03.T03_SHOUGAKKOU
			,T03.T03_CHUUGAKKOU
			,T03.T03_SHOUGAKKOU_KYORI
			,T03.T03_CHUUGAKKOU_KYORI
			,T03.T03_CONVENIENCE_KYORI
			,T03.T03_SUPERMARKET_KYORI
			,T03.T03_BYOUIN_KYORI
        	,'1' AS T03_KEISAI
		from
			T03WEB_HEYA_KEISAI_END T03
		where
			--T03.T03_DAIHYO_FLG		=	1
            T03.T03_KOUKAI_FLAG		=	1
			AND T03.T03_DAIHYO_TATEMONO_CD	= '".$code."'";

 $sqlorder = " order by
 			T03.T03_DAIHYO_TATEMONO_CD
			,lpad(T03.T03_KAI,5)
			,lpad(T03.T03_HEYA_BANGOU,28)
			,T03.T03_HEYA_CD
";
 
 		 //部屋詳細の場合→T03WEB_HEYAだけ
		 if(isset($heya) && $heya != null && !empty($heya)){
		 	$sql .= " AND T03.T03_DAIHYO_FLG	=	1 AND T03.T03_HEYA_CD	!= '".$heya."'";
		 	$sql .= $sqlorder;
		 }
		 else { //建物場合→UNIONする
		 	$sql = 'SELECT * FROM ( ( ' . $sql . ') UNION ( ' . $sqlkeisai . ')
		 			) T03 ' . $sqlorder;
		 }

        return $this->dbGetList($sql);
    }
    

    /**
     * 代用建物コード取得
     * @param unknown $code
     * @param string $heya
     * @return データベースの出力結果
     */
    public function getArticleDetail2($code) {
    	$sql = "
			select T03_DAIHYO_TATEMONO_CD
    		from T03WEB_HEYA	
			WHERE T03_TATEMONO_CD = '" .$code ."' AND T03_KOUKAI_FLAG	=	1 AND ROWNUM = 1 ";
    
    	return $this->dbGetList($sql);
    }
    
    
    /**
     * 周辺で物件を探す
     * 町名まで完全一致
     * @param unknown $data
     */
    
	public function getShuuhenBukken($data){

        $sql = "
        SELECT DISTINCT
           T03.T03_HEYA_CD
			,T03.T03_DAIHYO_TATEMONO_CD
			,T03.T03_TATEMONO_NAME
			,T03.T03_TATEMONO_NAME_KOUKAI
			,T03.T03_TENPO_CD
			,T03.T03_ORIGINAL_TATEMONO_CD01
			,T03.T03_ORIGINAL_TATEMONO_CD02
			,T03.T03_ORIGINAL_HEYA_CD01
			,T03.T03_ORIGINAL_HEYA_CD02
			,T03.T03_TODOUFUKEN_CD
			,T03.T03_SHIKUCHOUSON_CD
            ,(SELECT M01_SHIKUCHOUSON FROM M01JYUUSHO WHERE M01_TODOUFUKEN_CD = T03.T03_TODOUFUKEN_CD AND M01_SHIKUCHOUSON_CD = T03.T03_SHIKUCHOUSON_CD AND rownum = 1) AS T03_SHIKUCHOUSON_NAME_JP
			,T03.T03_CHOUMEI_CD
		    ,T03.T03_CHOUMOKU_CD
		    ,T03.T03_JYUUSHO_TEXT
		    ,T03.T03_BANCHI
		    ,T03.T03_ANNAI_MAP_USE_FLAG
		    ,T03.T03_TATEMONO_TYPE_CD
		    ,T03.T03_TATEMONO_TYPE
		    ,T03.T03_TATEMONO_KOUZOU_CD
		    ,T03.T03_TATEMONO_KOUZOU
		    ,T03.T03_KAIDATE
		    ,T03.T03_KOSUU
		    ,T03.T03_KANSEINEN
		    ,T03.T03_KANSEITSUKI
		    ,T03.T03_KANSEIBI
			,T03.T03_SHINCHIKU_FLAG
			,T03.T03_TATEMONO_MENSEKI
			,T03.T03_SHIKICHI_MENSEKI
			,T03.T03_KAI
			,T03.T03_HEYA_BANGOU
        	,T03.T03_HEYA_BANGOU_HYOUZI
			,T03.T03_HOUGAKU
			,T03.T03_MADORI_CD
			,T03.T03_MADORI
			,T03.T03_SENYUU_MENSEKI
			,T03.T03_YACHIN
			,T03.T03_YACHIN_TAX
			,T03.T03_KANRIHI
			,T03.T03_KANRIHI_TAX
			,T03.T03_KYOUEKIHI
			,T03.T03_KYOUEKIHI_TAX
			,T03.T03_SHIKIKIN
			,T03.T03_REIKIN			
			,T03.T03_GAIKAN_GAZOU01
        	,DECODE(TRIM(NVL(T03_GAIKAN_GAZOU01, '')),'', 1,0) GAIKAN_UMU_FLAG
			,T03.T03_GAIKAN_GAZOU02
			,T03.T03_GAIKAN_GAZOU03
			,T03.T03_GAIKAN_GAZOU04
			,T03.T03_GAIKAN_GAZOU05
			,T03.T03_SHUHEN_GAZOU01
			,T03.T03_SHUHEN_GAZOU02
			,T03.T03_NAISOU_GAZOU01
			,T03.T03_NAISOU_GAZOU02
			,T03.T03_NAISOU_GAZOU03
			,T03.T03_NAISOU_GAZOU04
			,T03.T03_NAISOU_GAZOU05
			,T03.T03_NAISOU_GAZOU06
			,T03.T03_NAISOU_GAZOU07
			,T03.T03_NAISOU_GAZOU08
			,T03.T03_NAISOU_GAZOU09
			,T03.T03_NAISOU_GAZOU10
			,T03.T03_MADORIZU
			,T03.T03_TOUROKUBI
			,T03.T03_TOUROKUBI_STR
			,T03.T03_SAKUSEIBI
			,T03.T03_KOUSHINBI
			,T03.T03_FREERENT_FLAG
			,T03.T03_HEYAWARI_FLAG
			,T03.T03_MEYASU_CHINRYO
			,T03.T03_TEN_MEYASU_CHINRYO
			,T03.T03_GAIKAN_GAZOU_COMMON01
			,T03.T03_GAIKAN_GAZOU_COMMON02
			,T03.T03_GAIKAN_GAZOU_COMMON03
			,T03.T03_GAIKAN_GAZOU_COMMON04
			,T03.T03_GAIKAN_GAZOU_COMMON05
			,T03.T03_HAICHIZU_COMMON
			,T03.T03_SHUHEN_GAZOU_COMMON01
			,T03.T03_SHUHEN_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON01
			,T03.T03_NAISOU_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON03
			,T03.T03_NAISOU_GAZOU_COMMON04
			,T03.T03_NAISOU_GAZOU_COMMON05
			,T03.T03_NAISOU_GAZOU_COMMON06
			,T03.T03_NAISOU_GAZOU_COMMON07
			,T03.T03_NAISOU_GAZOU_COMMON08
			,T03.T03_NAISOU_GAZOU_COMMON09
			,T03.T03_NAISOU_GAZOU_COMMON10
			,T03.T03_MADORIZU_COMMON
			,T03.T03_PANORAMA_GAZOU01
			,T03.T03_PANORAMA_GAZOU02
			,T03.T03_PANORAMA_GAZOU_COMMON01
			,T03.T03_PANORAMA_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU01
			,T03.T03_FREE_GAZOU_TYPE01
			,T03.T03_FREE_GAZOU02
			,T03.T03_FREE_GAZOU_TYPE02
			,T03.T03_FREE_GAZOU03
			,T03.T03_FREE_GAZOU_TYPE03
			,T03.T03_FREE_GAZOU04
			,T03.T03_FREE_GAZOU_TYPE04
			,T03.T03_FREE_GAZOU05
			,T03.T03_FREE_GAZOU_TYPE05
			,T03.T03_FREE_GAZOU06
			,T03.T03_FREE_GAZOU_TYPE06
			,T03.T03_FREE_GAZOU07
			,T03.T03_FREE_GAZOU_TYPE07
			,T03.T03_FREE_GAZOU08
			,T03.T03_FREE_GAZOU_TYPE08
			,T03.T03_FREE_GAZOU09
			,T03.T03_FREE_GAZOU_TYPE09
			,T03.T03_FREE_GAZOU10
			,T03.T03_FREE_GAZOU_TYPE10
			,T03.T03_FREE_GAZOU11
			,T03.T03_FREE_GAZOU_TYPE11
			,T03.T03_FREE_GAZOU12
			,T03.T03_FREE_GAZOU_TYPE12
			,T03.T03_FREE_GAZOU_COMMON01
			,T03.T03_FREE_GAZOU_TYPE_COMMON01
			,T03.T03_FREE_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU_TYPE_COMMON02
			,T03.T03_FREE_GAZOU_COMMON03
			,T03.T03_FREE_GAZOU_TYPE_COMMON03
			,T03.T03_FREE_GAZOU_COMMON04
			,T03.T03_FREE_GAZOU_TYPE_COMMON04
			,T03.T03_FREE_GAZOU_COMMON05
			,T03.T03_FREE_GAZOU_TYPE_COMMON05
			,T03.T03_FREE_GAZOU_COMMON06
			,T03.T03_FREE_GAZOU_TYPE_COMMON06
			,T03.T03_FREE_GAZOU_COMMON07
			,T03.T03_FREE_GAZOU_TYPE_COMMON07
			,T03.T03_FREE_GAZOU_COMMON08
			,T03.T03_FREE_GAZOU_TYPE_COMMON08
			,T03.T03_FREE_GAZOU_COMMON09
			,T03.T03_FREE_GAZOU_TYPE_COMMON09
			,T03.T03_FREE_GAZOU_COMMON10
			,T03.T03_FREE_GAZOU_TYPE_COMMON10
			,T03.T03_FREE_GAZOU_COMMON11
			,T03.T03_FREE_GAZOU_TYPE_COMMON11
			,T03.T03_FREE_GAZOU_COMMON12
			,T03.T03_FREE_GAZOU_TYPE_COMMON12
			,T03.T03_NAISOU_GAZOU_TYPE01
			,T03.T03_NAISOU_GAZOU_TYPE02
			,T03.T03_NAISOU_GAZOU_TYPE03
			,T03.T03_NAISOU_GAZOU_TYPE04
			,T03.T03_NAISOU_GAZOU_TYPE05
			,T03.T03_NAISOU_GAZOU_TYPE06
			,T03.T03_NAISOU_GAZOU_TYPE07
			,T03.T03_NAISOU_GAZOU_TYPE08
			,T03.T03_NAISOU_GAZOU_TYPE09
			,T03.T03_NAISOU_GAZOU_TYPE10
        	,T03.T03_SHIKIKIN_TSUKISUU
        	,T03.T03_REIKIN_TSUKISUU
        	,T03.T03_HOSHOUKIN_TSUKISUU
        	,T03.T03_HOSHOUKIN
						
        from 
			T03WEB_HEYA T03
		where
			T03.T03_DAIHYO_FLG		=	1
            AND T03.T03_KOUKAI_FLAG		=	1 
            AND T03.T03_TODOUFUKEN_CD = '".$data['T03_TODOUFUKEN_CD']."'".
(!empty($data['T03_SHIKUCHOUSON_CD']) ? " AND T03.T03_SHIKUCHOUSON_CD = '".$data['T03_SHIKUCHOUSON_CD']."'" : "").
(!empty($data['T03_CHOUMEI_CD']) ? " AND T03.T03_CHOUMEI_CD = '".$data['T03_CHOUMEI_CD']."'" : "").           
(!empty($data['T03_TATEMONO_CD']) ? " AND T03.T03_TATEMONO_CD != '".$data['T03_TATEMONO_CD']."'" : "");
        
        $sql .= "  ORDER BY DBMS_RANDOM.RANDOM ";

        $sql = 'SELECT * FROM (' . $sql . ') WHERE rownum <= ' . (!empty($data['take']) ? $data['take'] : 6);
        
        return $this->dbGetList($sql);
    }
   
    /**
     * 周辺で物件を探す(沿線・駅)
     * 町名まで完全一致
     * @param unknown $data
     */
    
    public function getShuuhenBukkenForLine($params){
    	 
    	$StCds = "'" . join("','", $params['StCd']) . "'";
    	 
    	$sql = "
        SELECT DISTINCT
           T03.T03_HEYA_CD
			,T03.T03_TATEMONO_CD
			,T03.T03_TATEMONO_NAME
			,T03.T03_TATEMONO_NAME_KOUKAI
			,T03.T03_TENPO_CD
			,T03.T03_ORIGINAL_TATEMONO_CD01
			,T03.T03_ORIGINAL_TATEMONO_CD02
			,T03.T03_ORIGINAL_HEYA_CD01
			,T03.T03_ORIGINAL_HEYA_CD02
			,T03.T03_TODOUFUKEN_CD
			,T03.T03_SHIKUCHOUSON_CD
            ,(SELECT M01_SHIKUCHOUSON FROM M01JYUUSHO WHERE M01_TODOUFUKEN_CD = T03.T03_TODOUFUKEN_CD AND M01_SHIKUCHOUSON_CD = T03.T03_SHIKUCHOUSON_CD AND rownum = 1) AS T03_SHIKUCHOUSON_NAME_JP
			,T03.T03_CHOUMEI_CD
		    ,T03.T03_CHOUMOKU_CD
		    ,T03.T03_JYUUSHO_TEXT
		    ,T03.T03_BANCHI
		    ,T03.T03_ANNAI_MAP_USE_FLAG
		    ,T03.T03_TATEMONO_TYPE_CD
		    ,T03.T03_TATEMONO_TYPE
		    ,T03.T03_TATEMONO_KOUZOU_CD
		    ,T03.T03_TATEMONO_KOUZOU
		    ,T03.T03_KAIDATE
		    ,T03.T03_KOSUU
		    ,T03.T03_KANSEINEN
		    ,T03.T03_KANSEITSUKI
		    ,T03.T03_KANSEIBI
			,T03.T03_SHINCHIKU_FLAG
			,T03.T03_TATEMONO_MENSEKI
			,T03.T03_SHIKICHI_MENSEKI
			,T03.T03_KAI
			,T03.T03_HEYA_BANGOU
        	,T03.T03_HEYA_BANGOU_HYOUZI
			,T03.T03_HOUGAKU
			,T03.T03_MADORI_CD
			,T03.T03_MADORI
			,T03.T03_SENYUU_MENSEKI
			,T03.T03_YACHIN
			,T03.T03_YACHIN_TAX
			,T03.T03_KANRIHI
			,T03.T03_KANRIHI_TAX
			,T03.T03_KYOUEKIHI
			,T03.T03_KYOUEKIHI_TAX
			,T03.T03_SHIKIKIN
			,T03.T03_REIKIN
			,T03.T03_GAIKAN_GAZOU01
        	,DECODE(TRIM(NVL(T03_GAIKAN_GAZOU01, '')),'', 1,0) GAIKAN_UMU_FLAG
			,T03.T03_GAIKAN_GAZOU02
			,T03.T03_GAIKAN_GAZOU03
			,T03.T03_GAIKAN_GAZOU04
			,T03.T03_GAIKAN_GAZOU05
			,T03.T03_SHUHEN_GAZOU01
			,T03.T03_SHUHEN_GAZOU02
			,T03.T03_NAISOU_GAZOU01
			,T03.T03_NAISOU_GAZOU02
			,T03.T03_NAISOU_GAZOU03
			,T03.T03_NAISOU_GAZOU04
			,T03.T03_NAISOU_GAZOU05
			,T03.T03_NAISOU_GAZOU06
			,T03.T03_NAISOU_GAZOU07
			,T03.T03_NAISOU_GAZOU08
			,T03.T03_NAISOU_GAZOU09
			,T03.T03_NAISOU_GAZOU10
			,T03.T03_MADORIZU
			,T03.T03_TOUROKUBI
			,T03.T03_TOUROKUBI_STR
			,T03.T03_SAKUSEIBI
			,T03.T03_KOUSHINBI
			,T03.T03_FREERENT_FLAG
			,T03.T03_HEYAWARI_FLAG
			,T03.T03_MEYASU_CHINRYO
			,T03.T03_TEN_MEYASU_CHINRYO
			,T03.T03_GAIKAN_GAZOU_COMMON01
			,T03.T03_GAIKAN_GAZOU_COMMON02
			,T03.T03_GAIKAN_GAZOU_COMMON03
			,T03.T03_GAIKAN_GAZOU_COMMON04
			,T03.T03_GAIKAN_GAZOU_COMMON05
			,T03.T03_HAICHIZU_COMMON
			,T03.T03_SHUHEN_GAZOU_COMMON01
			,T03.T03_SHUHEN_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON01
			,T03.T03_NAISOU_GAZOU_COMMON02
			,T03.T03_NAISOU_GAZOU_COMMON03
			,T03.T03_NAISOU_GAZOU_COMMON04
			,T03.T03_NAISOU_GAZOU_COMMON05
			,T03.T03_NAISOU_GAZOU_COMMON06
			,T03.T03_NAISOU_GAZOU_COMMON07
			,T03.T03_NAISOU_GAZOU_COMMON08
			,T03.T03_NAISOU_GAZOU_COMMON09
			,T03.T03_NAISOU_GAZOU_COMMON10
			,T03.T03_MADORIZU_COMMON
			,T03.T03_PANORAMA_GAZOU01
			,T03.T03_PANORAMA_GAZOU02
			,T03.T03_PANORAMA_GAZOU_COMMON01
			,T03.T03_PANORAMA_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU01
			,T03.T03_FREE_GAZOU_TYPE01
			,T03.T03_FREE_GAZOU02
			,T03.T03_FREE_GAZOU_TYPE02
			,T03.T03_FREE_GAZOU03
			,T03.T03_FREE_GAZOU_TYPE03
			,T03.T03_FREE_GAZOU04
			,T03.T03_FREE_GAZOU_TYPE04
			,T03.T03_FREE_GAZOU05
			,T03.T03_FREE_GAZOU_TYPE05
			,T03.T03_FREE_GAZOU06
			,T03.T03_FREE_GAZOU_TYPE06
			,T03.T03_FREE_GAZOU07
			,T03.T03_FREE_GAZOU_TYPE07
			,T03.T03_FREE_GAZOU08
			,T03.T03_FREE_GAZOU_TYPE08
			,T03.T03_FREE_GAZOU09
			,T03.T03_FREE_GAZOU_TYPE09
			,T03.T03_FREE_GAZOU10
			,T03.T03_FREE_GAZOU_TYPE10
			,T03.T03_FREE_GAZOU11
			,T03.T03_FREE_GAZOU_TYPE11
			,T03.T03_FREE_GAZOU12
			,T03.T03_FREE_GAZOU_TYPE12
			,T03.T03_FREE_GAZOU_COMMON01
			,T03.T03_FREE_GAZOU_TYPE_COMMON01
			,T03.T03_FREE_GAZOU_COMMON02
			,T03.T03_FREE_GAZOU_TYPE_COMMON02
			,T03.T03_FREE_GAZOU_COMMON03
			,T03.T03_FREE_GAZOU_TYPE_COMMON03
			,T03.T03_FREE_GAZOU_COMMON04
			,T03.T03_FREE_GAZOU_TYPE_COMMON04
			,T03.T03_FREE_GAZOU_COMMON05
			,T03.T03_FREE_GAZOU_TYPE_COMMON05
			,T03.T03_FREE_GAZOU_COMMON06
			,T03.T03_FREE_GAZOU_TYPE_COMMON06
			,T03.T03_FREE_GAZOU_COMMON07
			,T03.T03_FREE_GAZOU_TYPE_COMMON07
			,T03.T03_FREE_GAZOU_COMMON08
			,T03.T03_FREE_GAZOU_TYPE_COMMON08
			,T03.T03_FREE_GAZOU_COMMON09
			,T03.T03_FREE_GAZOU_TYPE_COMMON09
			,T03.T03_FREE_GAZOU_COMMON10
			,T03.T03_FREE_GAZOU_TYPE_COMMON10
			,T03.T03_FREE_GAZOU_COMMON11
			,T03.T03_FREE_GAZOU_TYPE_COMMON11
			,T03.T03_FREE_GAZOU_COMMON12
			,T03.T03_FREE_GAZOU_TYPE_COMMON12
			,T03.T03_NAISOU_GAZOU_TYPE01
			,T03.T03_NAISOU_GAZOU_TYPE02
			,T03.T03_NAISOU_GAZOU_TYPE03
			,T03.T03_NAISOU_GAZOU_TYPE04
			,T03.T03_NAISOU_GAZOU_TYPE05
			,T03.T03_NAISOU_GAZOU_TYPE06
			,T03.T03_NAISOU_GAZOU_TYPE07
			,T03.T03_NAISOU_GAZOU_TYPE08
			,T03.T03_NAISOU_GAZOU_TYPE09
			,T03.T03_NAISOU_GAZOU_TYPE10
    
        FROM
        	(SELECT M03_ENSEN_CD, M03_EKI_CD
					from M03EKI
					where M03_RENRAKU_EKI_CD in
								(
									select 	M03_RENRAKU_EKI_CD
									from
										M03EKI M03
									where
										M03_EKI_CD in ( ". $StCds." )
								)
								union
								select	M03_ENSEN_CD, M03_EKI_CD
								from	M03EKI M03
								where	M03_EKI_CD in ( ".$StCds." )
				) M03,
			T03WEB_HEYA T03
    
		WHERE
    
			T03.T03_DAIHYO_FLG		=	1
            AND T03.T03_KOUKAI_FLAG		=	1
            AND T03.T03_TODOUFUKEN_CD = '".$params['PrefCd']. "'".
                "   AND (
            		M03.M03_EKI_CD = T03.T03_EKI_CD01
            		OR	M03.M03_EKI_CD = T03.T03_EKI_CD02
            		OR	M03.M03_EKI_CD = T03.T03_EKI_CD03
            ) ";
    
    	$sql .= "  ORDER BY DBMS_RANDOM.RANDOM ";
    	$sql = 'SELECT * FROM (' . $sql . ') WHERE rownum <= ' . (!empty($params['take']) ? $params['take'] : 6);
    
    	return $this->dbGetList($sql);
    }
    
    /**
     * 物件詳細データを表示用に変換
     *
     * @access	public
     * @param	array ※参照渡し
     * @return	void
     */
    public function convertData(&$bukenData,$param)
    {
    
        // OEM判定
        $OemFlg = $this->isOem($param);
        // 法人判定
        $AsnnetFlg = $this->isAsnnet($param);
   
        for($i=0;$i<count($bukenData);$i++){                     
             // 交通1
            $bukenData[$i]["CONVERT_T03_KOUTSU_STR01"] = Apm_Bukkenitems::GetTrafficStr2($bukenData[$i]);
            // 交通2
            $bukenData[$i]["CONVERT_T03_KOUTSU_STR02"] = Apm_Bukkenitems::GetTrafficStr2($bukenData[$i],"02");
            // 交通3            
            $bukenData[$i]["CONVERT_T03_KOUTSU_STR03"] = Apm_Bukkenitems::GetTrafficStr2($bukenData[$i],"03");
            $bukenData[$i]["CONVERT_T03_HOUGAKU"] = Apm_Bukkenitems::GetHeyamukiStrSimple($bukenData[$i]);
            
            if($OemFlg != 1 && $AsnnetFlg != 1) {
                // 交通1(PC用)
                $bukenData[$i]["CONVERT_T03_KOUTSU_STR01_PC"] = Apm_Bukkenitems::GetTrafficStr3($bukenData[$i], "01", $this->_db);
                // 交通2(PC用)
                $bukenData[$i]["CONVERT_T03_KOUTSU_STR02_PC"] = Apm_Bukkenitems::GetTrafficStr3($bukenData[$i], "02", $this->_db);
                // 交通3(PC用)
                $bukenData[$i]["CONVERT_T03_KOUTSU_STR03_PC"] = Apm_Bukkenitems::GetTrafficStr3($bukenData[$i], "03", $this->_db);
            } else {
                // 交通1(PC用)
                $bukenData[$i]["CONVERT_T03_KOUTSU_STR01_PC"] = $bukenData[$i]["CONVERT_T03_KOUTSU_STR01"];
                // 交通2(PC用)
                $bukenData[$i]["CONVERT_T03_KOUTSU_STR02_PC"] = $bukenData[$i]["CONVERT_T03_KOUTSU_STR02"];
                // 交通3(PC用)
                $bukenData[$i]["CONVERT_T03_KOUTSU_STR03_PC"] = $bukenData[$i]["CONVERT_T03_KOUTSU_STR03"];
            }  
            // その他条件
            $bukenData[$i]["CONVERT_T03_SONOTA_JYOKEN"] = Apm_Bukkenitems::GetSonotaInfoStr($bukenData[$i]);
        }
    }
    
    public function getCamp($heyaCd){
        $db_params = array();
        $result = array();
    
        $db_params["heyaCd"] = $heyaCd;
    
        $sql = "";
        $sql .= " SELECT";
        $sql .= "     *";
        $sql .= " FROM";
        $sql .= "     (";
        $sql .= "         SELECT";
        $sql .= "             c.M94_ITEM_ICON,";
        $sql .= "             b.M94_CAMPAIGN_URL,";
        $sql .= "             b.M94_CAMPAIGN_NAME,";
        $sql .= "             b.M94_CAMPAIGN_KBN,";
        $sql .= "             b.M94_CAMPAIGN_TOKUSYU_KBN,";
        $sql .= "             b.M94_CAMPAIGN_PRIORITY_NO,";
        $sql .= "             b.M94_START_YMD";
        $sql .= "         FROM";
        $sql .= "             T03WEB_HEYA_CAMPAIGN a,";
        $sql .= "             M94CAMPAIGN          b,";
        $sql .= "             M94CAMPAIGN_ITEM     c";
        $sql .= "         WHERE";
        $sql .= "             a.T03_HEYA_CD = :heyaCd";
        $sql .= "         AND b.M94_CAMPAIGN_CD = a.T03_CAMPAIGN_CD";
        $sql .= "         AND NVL(b.M94_START_YMD,'99999999') <= TO_CHAR(SYSDATE, 'YYYYMMDD')";
        $sql .= "         AND NVL(b.M94_END_YMD,'99999999')   >= TO_CHAR(SYSDATE, 'YYYYMMDD')";
        $sql .= "         AND b.M94_DELETE_FLAG = 0";
        $sql .= "         AND b.M94_MOBILE_KBN  = '0'";
        $sql .= "         AND c.M94_CAMPAIGN_CD = a.T03_CAMPAIGN_CD";
        $sql .= "         AND (c.M94_ITEM_CD = a.T03_OTAKARA_CD or c.M94_CAMPAIGN_CD = 11 ) ";
        $sql .= "         AND NVL(c.M94_INSERT_DATE, SYSDATE+1) <= SYSDATE";
        $sql .= "         AND c.M94_DELETE_FLAG = 0";
        $sql .= "         AND (c.M94_DELETE_DATE > SYSDATE or c.M94_DELETE_DATE is null)";
        $sql .= "         UNION ALL";
        $sql .= "         SELECT";
        $sql .= "             c.M94_ITEM_ICON,";
        $sql .= "             b.M94_CAMPAIGN_URL,";
        $sql .= "             b.M94_CAMPAIGN_NAME,";
        $sql .= "             b.M94_CAMPAIGN_KBN,";
        $sql .= "             b.M94_CAMPAIGN_TOKUSYU_KBN,";
        $sql .= "             b.M94_CAMPAIGN_PRIORITY_NO,";
        $sql .= "             b.M94_START_YMD";
        $sql .= "         FROM ";
        $sql .= "             M94CAMPAIGN b";
        $sql .= "                 LEFT OUTER JOIN M94CAMPAIGN_ITEM c";
        $sql .= "                     ON c.M94_CAMPAIGN_CD = b.M94_CAMPAIGN_CD";
        $sql .= "                     AND c.M94_ITEM_CD = 1";
        $sql .= "                     AND NVL(c.M94_INSERT_DATE, SYSDATE+1) <= SYSDATE";
        $sql .= "                     AND c.M94_DELETE_FLAG = 0";
        $sql .= "                     AND (c.M94_DELETE_DATE > SYSDATE or c.M94_DELETE_DATE is null)";
        $sql .= "         WHERE ";
        $sql .= "             b.M94_CAMPAIGN_HYOUZI = 1 ";
        $sql .= "         AND b.M94_DELETE_FLAG = 0 ";
        $sql .= "         AND b.M94_CAMPAIGN_KBN IN (2,4) ";
        $sql .= "         AND b.M94_MOBILE_KBN = 0 ";
        $sql .= "         AND NVL(b.M94_START_YMD,'99999999') <= TO_CHAR(SYSDATE, 'YYYYMMDD')";
        $sql .= "         AND NVL(b.M94_END_YMD,'99999999')   >= TO_CHAR(SYSDATE, 'YYYYMMDD')";
        $sql .= "     )";
        $sql .= " order by";
        $sql .= "     M94_CAMPAIGN_KBN,";
        $sql .= "     M94_CAMPAIGN_TOKUSYU_KBN,";
        $sql .= "     M94_CAMPAIGN_PRIORITY_NO,";
        $sql .= "     NVL(M94_START_YMD,'99999999') desc";
    
        $temp = $this->dbGetList($sql, $db_params, $this->_db);
    
        //結果の存在確認
        if(!empty($temp)){
            $result = $temp[0];
        }
    
        return $result;
    }
}